package com.baizhi.service;

import com.baizhi.dao.BannerDao;
import com.baizhi.entrty.Banner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class BannerServiceImpl implements BannerService {
    @Autowired
    private BannerDao bd;
    @Override
    public Map fy(int page, int rows) {

        int count = bd.getCount();
        int start = (page-1)*rows;

        Map map = new HashMap();
        List<Banner> list = bd.getBanner(start,rows);

        map.put("total",count);
        map.put("rows",list);

        return map;
    }

    @Override
    public void xs(int[] id) {
        bd.xs(id);
    }

    @Override
    public void bxs(int[] id) {
        bd.bxs(id);
    }

    @Override
    public void insert(Banner ba) {

        bd.insert(ba);
    }

    @Override
    public void update(Banner ba) {

        bd.update(ba);
    }

    @Override
    public void addBanner(Banner banner) {
        bd.addBanner(banner);
    }

    @Override
    public List<Banner> showAll() {
        List<Banner> banners = bd.showAll();
        return banners;
    }
}
